import {http} from '../../http'
const headers = {
    // "Content-Type": "application/x-www-form-urlencoded",
    // "Content-Type": "multipart/form-data",
    'enctype': 'multipart/form-data',
    // Authorization: token,
  }
const uploadAvatar = ()=>{
    return `${import.meta.env.VITE_BASE_URL}/upload/modify_avatar`
}
//上传图片到后台
const upload = (params: any) => http.post('/upload/avatar', params,{headers})

//图片路径写入数据库
const writeSql = (params: any) => http.post('/upload/avatar_sql', params)

//轮播图路径写入数据库
const createCarousel = (params: any) => http.post('/upload/carousel', params)

//获取轮播图
const getCarousel = (params: any) => http.get('/upload/carousel', params)

//修改轮播图
const changeCarousel = (params: any) => http.put('/upload/carousel', params)

//删除轮播图数据
const deleteData = (params: any) => http.delete('/upload/delete', params)

export default {
    uploadAvatar,
    upload,
    writeSql,
    createCarousel,
    getCarousel,
    changeCarousel,
    deleteData
}